<template>
  <header>
    <div class="l-content">
      <el-button @click="handleMenu" plain icon="el-icon-menu" size="mini"></el-button>
      <h3>首页</h3>
    </div>
    <div class="r-content">
      <el-dropdown trigger="click" size="medium">
        <span>
          <img class="user" :src="userImg" alt="">
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item>
            <router-link to="/login">退出</router-link>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
export default {
  name: "CommonHeader",

  data() {
    return {
      userImg: require("@/assets/touxiang.jpg"),
    };
  },

  mounted() {},

  methods: {
    handleMenu(){
      this.$store.commit('collapseMenu');
    }
  },
};
</script>

<style lang="less" scoped>
header{
  display: flex;
  height: 100%;
  justify-content: space-between;
  align-items:center;
}
.l-content {
  display: flex;
  align-items: center;
  .el-button{
    margin-right: 20px;
  }
  h3 {
    color: #fff;
  }
}

.r-content{
  .user{
    width:50px;
    height: 50px;
    border-radius: 50%;
  }
}
.router-link-active {
  text-decoration: none;
}
a {
  text-decoration: none;
}
</style>
